package cn.itcast.hotel.wbe;


import cn.itcast.hotel.pojo.PageResult;
import cn.itcast.hotel.pojo.RequestParams;
import cn.itcast.hotel.service.impl.HotelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/hotel")
public class HotelController {

    @Autowired
    private HotelService hotelService;
    //搜索数据
    @PostMapping("/list")
    public PageResult search(@RequestBody RequestParams params){

        return hotelService.search(params);

    }
    @PostMapping("filters")
    public Map<String, List<String>> buildBasicQuery(@RequestBody RequestParams params){
            return hotelService.buildBasicQuery(params);
    }

    @GetMapping("/suggestion")
    public List<String> getSuggestions(@RequestParam("key")String prefix){
        return hotelService.getSuggestions(prefix);
    }




}
